package com.chenjie.executor.day15;

/**
 * packageName com.chenjie.executor.day14
 *
 * @author chenjie
 * @version JDK 8
 * @className TicketTask (此处以class为例)
 * @date 2024/5/28
 * @description TODO
 */
public class SetNameTask implements Runnable {
    private Student student;

    public SetNameTask(Student student) {
        this.student = student;
    }

    @Override
    public  void run() {
        //同步代码测试this
        student.setName(Thread.currentThread().getName());
        //同步代码测试new student
        student.setName0(Thread.currentThread().getName());
        //同步代码测试Student.class
        student.setName1(Thread.currentThread().getName());
        //同步方法测试
        student.setName2(Thread.currentThread().getName());
        //静态同步方法测试
        Student.setName3(Thread.currentThread().getName());

    }
}
